const $btn = $(".content .hot-links .details .btn");
const $hotLinksDetailsLi = $(".content .hot-links .details ul.details-current li");
const $hotLinksDetailsUL = $(".content .hot-links .details ul.details-current")

const arrayHeight = [];

Array.from($hotLinksDetailsLi).forEach(async li => {
    const height = await li.offsetTop
    arrayHeight.push(parseInt(height));
});

$btn.on("click", function () {
    $btn.toggleClass("show hide")
    var $text = $btn.text();
    if ($text === '展示') {
        $btn.html('隐藏');
        const result = Math.max.apply(null, arrayHeight) - Math.min.apply(null, arrayHeight) + 30;
        $hotLinksDetailsUL.css("height", result + 'px')
    } else {
        $btn.html("展示");
        $hotLinksDetailsUL.css("height", '30px')
    }
})